import Driver, { Step } from 'driver.js';
import 'driver.js/dist/driver.min.css';
import { useEffect } from 'react';
/**
 * @description 使用指引 hooks
 * */
const useDriver = (conf: Array<Step>) => {
	let driver: Driver;
	driver = new Driver({
		allowClose: false,
		// opacity: 0,
		closeBtnText: '退出指引',
		nextBtnText: '下一步',
		prevBtnText: '上一步',
		doneBtnText: '完成',
	});

	useEffect(() => {
		driver.defineSteps(conf);
	}, []);

	function opendriver() {
		driver.start();
	}
	return { opendriver };
};

export default useDriver;
